package com.expense.services;

import java.rmi.RemoteException;
import java.sql.SQLException;

import javax.xml.rpc.ServiceException;

import com.expense.util.PaginatedList;
import com.soap.awfp.client.IServiceInvokeHelper;
import com.soap.awfp.client.ServiceInvokeHelper;
import com.soap.awfp.client.ServiceInvokeHelperLocator;
import com.soap.awfp.client.WFParamObject;

public class WokflowProxy {

	/*
	 * 用户加入团体申请流程
	 * */
	public static Integer teamUserApply(java.lang.String recordID, java.lang.String groupID, java.lang.String applicantID, java.lang.String applicantName, java.lang.String applicantEmail, java.lang.String applyTitle, java.lang.String applyRemark, java.lang.String expandColumn1, java.lang.String expandColumn2, java.lang.String expandColumn3, com.soap.awfp.client.WFParamObject[] lstParam) throws SQLException, RemoteException, ServiceException
	{
		ServiceInvokeHelper serviceInvokeHelper=new ServiceInvokeHelperLocator();
		IServiceInvokeHelper wfhelper=serviceInvokeHelper.getBasicHttpBinding_IServiceInvokeHelper();
		String TSIID="da9f1910-30f2-47a2-a5fd-7f6cffa92837";
		// 业务类型键“TYSQ”表示团员申请
		String bussTypeKey="TYSQ";
		int aiid= wfhelper.createApplyInfoByBussTypeKey(TSIID, bussTypeKey, recordID, groupID, applicantID, applicantName, applicantEmail, applyTitle, applyRemark, expandColumn1, expandColumn2, expandColumn3, lstParam, null);
		//wfhelper.getApproveInfoLikeToAppRoleCodeDT(TSIID, appRoleCode, fields, approveStatus)
		return aiid;
	}
	/*
	 * 创建团体结算申请
	 * 返回申请ID
	 */
	public static Integer teamBalanceApply(java.lang.String recordID, java.lang.String groupID, java.lang.String applicantID, java.lang.String applicantName, java.lang.String applicantEmail, java.lang.String applyTitle, java.lang.String applyRemark, java.lang.String expandColumn1, java.lang.String expandColumn2, java.lang.String expandColumn3, com.soap.awfp.client.WFParamObject[] lstParam) throws SQLException, RemoteException, ServiceException 
	{
			ServiceInvokeHelper serviceInvokeHelper=new ServiceInvokeHelperLocator();
			IServiceInvokeHelper wfhelper=serviceInvokeHelper.getBasicHttpBinding_IServiceInvokeHelper();
			String TSIID="da9f1910-30f2-47a2-a5fd-7f6cffa92837";
			// 业务类型键“SPJS”表示结算申请流程
			String bussTypeKey="SPJS";	
			int aiid= wfhelper.createApplyInfoByBussTypeKey(TSIID, bussTypeKey, recordID, groupID, applicantID, applicantName, applicantEmail, applyTitle, applyRemark, expandColumn1, expandColumn2, expandColumn3, lstParam, null);
			
			return aiid;
	}

	/*
	 * 提交审批
	 * 返回申请ID
	 */
	public static Boolean submitApprove(java.lang.Integer approveID, java.lang.String addApproveCode, java.lang.String approverCode, java.lang.String approverName, com.soap.awfp.client.ApproveStatus appStatus, java.lang.String advice, java.lang.String expression1, java.lang.String expression2, java.lang.String expression3, com.soap.awfp.client.WFParamObject[] lstWFParam) throws SQLException, RemoteException, ServiceException 
	{
			ServiceInvokeHelper serviceInvokeHelper=new ServiceInvokeHelperLocator();
			IServiceInvokeHelper wfhelper=serviceInvokeHelper.getBasicHttpBinding_IServiceInvokeHelper();
			
			String aiid= wfhelper.submitApproveAdvice(approveID, addApproveCode, approverCode, approverName, appStatus, advice, expression1, expression2, expression3, lstWFParam);
			return true;
	}
	/*
	 * 获取个人待审列表
	 * */
	public PaginatedList getApprovalByUID(String uid,int pageSize ,int currentPage) throws ServiceException, RemoteException
	{
		ServiceInvokeHelper serviceInvokeHelper=new ServiceInvokeHelperLocator();
		IServiceInvokeHelper wfhelper=serviceInvokeHelper.getBasicHttpBinding_IServiceInvokeHelper();
		String TSIID="da9f1910-30f2-47a2-a5fd-7f6cffa92837";
		// 业务类型键“TYSQ”表示团员申请
		String bussTypeKey="TYSQ";
		wfhelper.getApplyByApproving(TSIID, bussTypeKey, uid);
//		String fields="RecordID,ApplicantID,ApplicantName";
//		wfhelper.getApplyInfoByApplicantID(TSIID, uid, fields);
		PaginatedList paginatedList=new PaginatedList();
		return paginatedList;
	}
}
